home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / FINDREPL.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  5KB  |  202 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1992, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.4  $
  6. //
  7. // Definition of FindReplace- abstract, Find-, Replace- common Dialog classes
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_FINDREPL_H)
  10. #define OWL_FINDREPL_H
  11.  
  12. #if !defined(OWL_COMMDIAL_H)
  13. # include <owl/commdial.h>
  14. #endif
  15.  
  16. #if defined(BI_NAMESPACE)
  17. namespace OWL {
  18. #endif
  19.  
  20. // Generic definitions/compiler options (eg. alignment) preceeding the 
  21. // definition of classes
  22. #include <services/preclass.h>
  23.  
  24. //
  25. // class TFindReplaceDialog
  26. // ~~~~~ ~~~~~~~~~~~~~~~~~~
  27. class _OWLCLASS TFindReplaceDialog : public TCommonDialog {
  28.   public:
  29.     class _OWLCLASS TData {
  30.       public:
  31.         uint32   Flags;
  32.         uint32   Error;
  33.         char*    FindWhat;
  34.         char*    ReplaceWith;
  35.         int      BuffSize;
  36.  
  37.         TData(uint32 flags = 0, int buffSize = 81);
  38.         TData(const TData& src);
  39.        ~TData();
  40.  
  41.         TData& operator =(const TData& src);
  42.  
  43.         void     Write(opstream& os);
  44.         void     Read(ipstream& is);
  45.     };
  46.  
  47.     TFindReplaceDialog(TWindow*        parent,
  48.                        TData&          data,
  49.                        TResId          templateId = 0,
  50.                        const char far* title = 0,
  51.                        TModule*        module = 0);
  52.  
  53.     void         UpdateData(TParam2 param = 0);
  54.  
  55.   protected:
  56.     HWND         DoCreate() = 0;
  57.  
  58.     TFindReplaceDialog(TWindow*        parent,
  59.                        TResId          templateId = 0,
  60.                        const char far* title = 0,
  61.                        TModule*        module = 0);
  62.  
  63.     void     Init(TResId templateId);
  64.     bool     DialogFunction(uint message, TParam1, TParam2);
  65.  
  66.     TData&   GetData();
  67.     void     SetData(TData& data);
  68.  
  69.     FINDREPLACE&  GetFR();
  70.     void   SetFR(const FINDREPLACE& _fr);
  71.  
  72.     // Default behavior inline for message response functions
  73.     //
  74.     void     CmFindNext();   //EV_COMMAND(IDOK,
  75.     void     CmReplace();    //EV_COMMAND(psh1,
  76.     void     CmReplaceAll(); //EV_COMMAND(psh2,
  77.     void     CmCancel();     //EV_COMMAND(IDCANCEL,
  78.  
  79.     void     EvNCDestroy();
  80.  
  81.   protected_data:
  82.     FINDREPLACE  fr;
  83.     TData&       Data;
  84.  
  85.   DECLARE_RESPONSE_TABLE(TFindReplaceDialog);
  86.   DECLARE_CASTABLE;
  87. };
  88.  
  89. //
  90. // class TFindDialog
  91. // ~~~~~ ~~~~~~~~~~~
  92. class _OWLCLASS TFindDialog : public TFindReplaceDialog {
  93.   public:
  94.     TFindDialog(TWindow*        parent,
  95.                 TData&          data,
  96.                 TResId          templateId = 0,
  97.                 const char far* title = 0,
  98.                 TModule*        module = 0);
  99.  
  100.   protected:
  101.     HWND     DoCreate();
  102.  
  103.   private:
  104.     TFindDialog();
  105.     TFindDialog(const TFindDialog&);
  106.  
  107.   DECLARE_CASTABLE;
  108. };
  109.  
  110. //
  111. // class TReplaceDialog
  112. // ~~~~~ ~~~~~~~~~~~~~~
  113. class _OWLCLASS TReplaceDialog : public TFindReplaceDialog {
  114.   public:
  115.     TReplaceDialog(TWindow*        parent,
  116.                    TData&          data,
  117.                    TResId          templateId = 0,
  118.                    const char far* title = 0,
  119.                    TModule*        module = 0);
  120.  
  121.   protected:
  122.     HWND     DoCreate();
  123.  
  124.   private:
  125.     TReplaceDialog(const TReplaceDialog&);
  126.     TReplaceDialog& operator=(const TReplaceDialog&);
  127.  
  128.   DECLARE_CASTABLE;
  129. };
  130.  
  131. // Generic definitions/compiler options (eg. alignment) following the 
  132. // definition of classes
  133. #include <services/posclass.h>
  134.  
  135. #if defined(BI_NAMESPACE)
  136. } // namespace OWL
  137. #endif
  138.  
  139. //----------------------------------------------------------------------------
  140. // Inline implementations
  141. //
  142.  
  143. //
  144. // Return the transfer data for the find and replace dialog.
  145. //
  146. inline TFindReplaceDialog::TData& TFindReplaceDialog::GetData() {
  147.   return Data;
  148. }
  149.  
  150. //
  151. // Set the transfer data for the dialog.
  152. //
  153. inline void  TFindReplaceDialog::SetData(TData& data) {
  154.   Data = data;
  155. }
  156.  
  157. //
  158. // Return the underlying system structure for the find and replace dialog.
  159. //
  160. inline FINDREPLACE& TFindReplaceDialog::GetFR() {
  161.   return fr;
  162. }
  163.  
  164. //
  165. // Set the underlying system structure for the dialog.
  166. //
  167. inline void TFindReplaceDialog::SetFR(const FINDREPLACE& _fr) {
  168.   fr = _fr;
  169. }
  170.  
  171. //
  172. // Default behavior inline for message response functions
  173. //
  174. inline void TFindReplaceDialog::CmFindNext() {
  175.   DefaultProcessing();
  176. }
  177.  
  178. //
  179. // Default behavior inline for message response functions
  180. //
  181. inline void TFindReplaceDialog::CmReplace() {
  182.   DefaultProcessing();
  183. }
  184.  
  185. //
  186. // Default behavior inline for message response functions
  187. //
  188. inline void TFindReplaceDialog::CmReplaceAll() {
  189.   DefaultProcessing();
  190. }
  191.  
  192. //
  193. // Default behavior inline for message response functions
  194. //
  195. inline void TFindReplaceDialog::CmCancel() {
  196.   DefaultProcessing();
  197. }
  198.  
  199.  
  200.  
  201. #endif  // OWL_FINDREPL_H
  202.